<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>54数组扁平化、去重与排序</title>
</head>
<body>
<script>
  let arr = [40, 9, 20, 4, [1, 2, 3, 4], [2, 3, 4, [1, 2, 3, [1, 2, 3]], 5], [1, 2, 3, 4], [3, 4, 5, 9]]

  console.log(Array.from(new Set(arr.flat(Infinity))).sort((a,b)=>a-b));

</script>
</body>
</html>